//
//  InSoundTableViewCell.m
//  Inner  Voice
//
//  Created by 徐海宇 on 16/3/3.
//  Copyright © 2016年 徐海宇. All rights reserved.
//

#import "InSoundTableViewCell.h"

#import "InSoundDetail.h"

#import "InSoundedFrame.h"

@interface InSoundTableViewCell ()

@end

@implementation InSoundTableViewCell

//注册类
+ (instancetype)statusCellWithTaleView:(UITableView *)tableView WithIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellIdentify = @"statusCell";
    static BOOL isRegist = NO;
    if (isRegist == NO) {
        isRegist = YES;
        [tableView registerClass:[InSoundTableViewCell class] forCellReuseIdentifier:cellIdentify];
    }
    return [tableView dequeueReusableCellWithIdentifier:cellIdentify forIndexPath:indexPath];
    //    return [tableView dequeueReusableCellWithIdentifier:cellIdentify forIndexPath:];
}

//重写cell的style

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        UILabel *textViewLabel = [[UILabel alloc] init];
        textViewLabel.numberOfLines = 0;
        textViewLabel.font = kTextFont;
        self.textViewLabel = textViewLabel;
        [self.contentView addSubview:textViewLabel];
    }
    return self;
}

//重写label的frame的方法
- (void)setInSoundedFrame:(InSoundedFrame *)inSoundedFrame {
    
    _inSoundedFrame = inSoundedFrame;
    
    [self setData];
    
    [self setDataFrame];
}

//给cell加上数据
- (void)setData {
    
    InSoundDetail *soundDetail = self.inSoundedFrame.soundDetail;
    
    self.textViewLabel.text = soundDetail.sound_info;
    UIImageView *imag = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    imag.image = [UIImage imageNamed:@"222"];
    [self.contentView addSubview:imag];
}



- (void)setDataFrame {
    
    self.textViewLabel.frame = self.inSoundedFrame.textViewLabelFrame;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
